<?php
$this->breadcrumbs=array(
	'Events'=>array('index'),
	$model->name,
);

$this->menu=array(
	array('label'=>'List Events', 'url'=>array('index')),
	array('label'=>'Create Events', 'url'=>array('create')),
	array('label'=>'Update Events', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete Events', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage Events', 'url'=>array('admin')),
);
?>
<div class="main-content">
<h1>View Event: <?php echo $model->name; ?></h1>

<?php

$attendingPNMHTML = "(Count: " . count($attendedPNM) . ")";
foreach ($attendedPNM as $pnm) {
    $attendingPNMHTML = $attendingPNMHTML . "<br />" . CHtml::link($pnm->first_name . " " . $pnm->last_name, array('pnm/view/id/' . $pnm->id));
}

$this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		//'id',
		'name',
		'date',
		'description',
        array(
            'label' => 'PNMs That Attended',
            'type' => 'raw',
            'value' => $attendingPNMHTML,
        )
	),
)); ?>

</div>

<div class="main-content">
<h1>Attending PNMs</h1>
<?php
echo CHtml::beginForm();
foreach ($mPNMs as $pnm) {
    $checked = false;
    foreach ($mAttendedPNMs as $attendedPNM) {

        if ($attendedPNM->pnm_id == $pnm->id) {
            $checked = true;
            
            break;
        }
    }
    echo CHtml::checkBox('pnm[' . $pnm->id . ']', $checked);
    echo CHtml::label($pnm->first_name . " " . $pnm->last_name, 'pnm[' . $pnm->id . ']');
    echo "<br />";
}
echo CHtml::submitButton("Save");
echo CHtml::endForm();
?>
</div>